python count code, Count number of occurrences of a given substring

24

# define string
string = "Python is awesome, isn't it?"
substring = "is"

count = string.count(substring)

# print count
print("The count is:", count)

Comments

Submit
0 Comments